package com.campusevaluation.common.utils;

public class UserContext {
    private static final ThreadLocal<Long> tl = new ThreadLocal<>();

    /**
     * 保存当前用户ID
     * @param userId
     */
    public static void setUserId(Long userId) {tl.set(userId);}

    /**
     * 获取当前用户ID
     * @return
     */
    public static Long getUserId() {return tl.get();}

    public static void clear() {tl.remove();}
}
